package org.example.proxy.jdk;


import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @author : RXK
 * Date : 2021/5/27 10:57
 * Code Less Think More
 * Desc:
 */
public class DynamicProxyInvocationHandler implements InvocationHandler {

    private final HelloService target;

    public DynamicProxyInvocationHandler(HelloService target) {
        this.target = target;
    }


    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("I'm Dynamic Proxy");
        return method.invoke(target,args);
    }
}
